<template>
  <div class="department">
    <PageSearch
      @query-click="handleQueryClick"
      @reset-click="handleResetClick"
    />
    <PageContent
      ref="contentRef"
      @new-click="handleNewClick"
      @edit-click="handleEditClick"
    />
    <PageModal ref="modalRef" />
  </div>
</template>

<script setup lang="ts">
import PageSearch from './subcomponent/page-search.vue'
import PageContent from './subcomponent/page-content.vue'
import PageModal from './subcomponent/page-modal.vue'
import { ref } from 'vue'

const contentRef = ref<InstanceType<typeof PageContent>>()
function handleQueryClick(queryInfo: any) {
  contentRef.value?.fetchPagePageData(queryInfo)
}
function handleResetClick() {
  contentRef.value?.fetchPagePageData()
}
// 新建数据
const modalRef = ref<InstanceType<typeof PageModal>>()
function handleNewClick() {
  modalRef.value?.setModalVisible()
}
function handleEditClick(data: any) {
  modalRef.value?.setModalVisible(false, data)
}
</script>

<style lang="scss" scoped></style>
